<template>
	<view class="page">
		<view class="title">
			<view class="title_fir">
				<view class="title_fir_left">
					可用余额
				</view>
				<view class="title_fir_right" @click="toPath('details')">
					钱包明细
					<image src="../../static/purse/mingxi@3x.png" mode="" class="title_fir_right_img"></image>
				</view>
			</view>
			<view class="title_se">
				{{orderamount}}
			</view>
			<view class="title_thr">
				<view class="title_thr_left">
					待结算资金(元)
				</view>
				<view class="">
					{{settlement}}
				</view>
			</view>
			<view class="title_thr">
				<view class="title_thr_left">
					可用余额(元)
				</view>
				<view class="">
					{{all_amount}}
				</view>
			</view>
			<view class="title_four">
				<view class="title_four_btn" @click="toPath('recharge')">
					充值
				</view>
				<view style="border-left: 1px solid #b2b2b2;">
				</view>
				<view class="title_four_btn" @click="toPath('transfer')">
					转账
				</view>
				<view style="border-left: 1px solid #b2b2b2;">
				</view>
				<view class="title_four_btn" @click="toPath('payouts')">
					提现
				</view>
			</view>
		</view>
		<view class="body_">
			精选服务
			<view class="body_img">
				<image src="../../static/purse/jingxuanfuwu@3x.png" mode="" class="image"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getIndex,
	} from '../../api/index/index.js'
	export default {
		data() {
			return {
				ordernum: '',
				orderamount: '',
				settlement: '',
				all_amount: '',
				statistical: ''
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init() {
				getIndex().then(res => {
					if (res.data.is_fz == 1) {
						console.log("冻结");
						this.Notice("冻结通知")
					}
					this.ordernum = res.data.today_order_num;
					this.orderamount = res.data.today_order_total;
					this.settlement = res.data.today_no_settlement;
					this.all_amount = res.data.money;
					this.statistical = res.data.statistical;
				})
			},
			toPath(e) {
				if (e == 'recharge') {
					uni.navigateTo({
						url: '/pages/recharge/index'
					})
				} else if (e == 'transfer') {
					uni.navigateTo({
						url: '/pages/transfer/index'
					})
				} else if (e == 'payouts') {
					uni.navigateTo({
						url: '/pages/payouts/index'
					})
				} else if (e == "details") {
					uni.navigateTo({
						url: '/pages/walletDetails/index'
					})
				}
			}
		}
	}
</script>

<style lang="less" scoped>
	.page {
		height: 100%;
		background: linear-gradient(#ff5220, #f5f5f5, #f5f5f5, #f5f5f5);

		.title {
			background-color: white;
			margin: 40rpx;
			padding: 30rpx;
			border-radius: 15rpx;

			.title_fir {
				display: flex;
				justify-content: space-between;

				.title_fir_left {
					font-size: 13px;
				}

				.title_fir_right {
					font-size: 15px;
					color: #b2b2b2;
					flex-direction: column;
					align-items: center;

					.title_fir_right_img {
						margin-left: 5px;
						height: 14px;
						width: 14px;
					}
				}

			}

			.title_se {
				font-size: 30px;
			}

			.title_thr {
				display: flex;
				justify-content: space-between;
				height: 30px;
				font-size: 16px;
				padding-top: 10px;

				.title_thr_left {
					color: #b2b2b2;
				}
			}

			.title_four {
				display: flex;
				justify-content: space-between;

				.title_four_btn {
					text-align: center;
				}
			}
		}

		.body_ {
			padding: 30rpx;
			font-size: 20px;

			.body_img {
				margin-top: 10px;
				height: 65px;
				width: 345px;
				display: block;
				margin-left: auto;
				margin-right: auto;

				.image {
					width: 100%;
					height: 100%;
				}
			}
		}
	}
</style>